Function Reference

_TS_RunningTaskList

Returns a list of all currently running Tasks.

#Include <TaskScheduler.au3>
_TS_RunningTaskList($oService[, $iShowHidden = 0])

 

Parameters

$oService Task Scheduler Service object as returned by _TS_Open
$iShowHidden [optional] Returns hidden Tasks as well when set to 1 (default = 0)

 

Return Value

Success: two-dimensional zero based array with the following information:
    0 - CurrentAction: Name of the current action that the running task is performing
    1 - EnginePID: Process ID for the engine (process) which is running the task
    2 - InstanceGuid: GUID identifier for this instance of the task
    3 - Name: Name of the task
    4 - Path: Path to where the task is stored
    5 - State: State of the running task (usually $TASK_STATE_RUNNING)
Failure: Returns "" and sets @error:
    1001 - Error retrieving the RunningTasks collection. @extended is set to the COM error code

 

Remarks

None.

 

Related

 

Example


#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include-once
#include <TaskScheduler.au3>
#include <Array.au3>
AutoItSetOption("MustDeclareVars", 1)

; *****************************************************************************
; Connect to the Task Scheduler Service
; *****************************************************************************
Global $oService = _TS_Open()
If @error <> 0 Then Exit MsgBox($MB_ICONERROR, "Task Scheduler UDF", "Error connecting to the Task Scheduler Service. @error = " & @error & ", @extended = " & @extended & @CRLF & @CRLF & _TS_ErrorText(@error))

; *****************************************************************************
; List all running tasks. Show hidden tasks.
; *****************************************************************************
Global $aTasks = _TS_RunningTaskList($oService, 1)
If Not @error Then
    _ArrayDisplay($aTasks, "_TS_RunningTaskList", "", 0, Default, "Current Action|EnginePID|IntanceGUID|Name|Path|State")
Else
    MsgBox($MB_ICONERROR, "_TS_RunningTaskList", "Returned @error=" & @error & ", @extended=" & @extended & @CRLF & @CRLF & _TS_ErrorText(@error))
EndIf

_TS_Close()